import java.util.Arrays;

/**
 * ClassName NewKnowledge
 * Description TODO
 * Author Yanyan
 * Date 2025/11/7 17:14
 * Version 1.0
 */
public class NewKnowledge {

    public static void main(String[] args) {
        MyDate mydate = new MyDate();
        mydate = new MyDate();
        mydate = new MyDate();
        mydate = new MyDate();
        mydate = new MyDate();

        mydate.printDate();

        System.out.println(mydate);
    }


    public static void swap(MyValue myValue1,MyValue myValue2) {
        int tmp = myValue1.val;
        myValue1.val = myValue2.val;
        myValue2.val = tmp;
    }


    public static void main6(String[] args) {
        MyValue myValue1 = new MyValue();
        myValue1.val = 10;

        MyValue myValue2 = new MyValue();
        myValue2.val = 20;

        System.out.println("交换前" + myValue1.val + " " +myValue2.val);

        swap(myValue1,myValue2);

        System.out.println("交换后" + myValue1.val + " " + myValue2.val);
    }


    public static void main5(String[] args) {

        MyDate myDate = new MyDate();
        myDate.setDate(2025,11,7);
        myDate.printDate();

        MyDate myDate2 = new MyDate();
        myDate2.setDate(2026,7,6);
        myDate2.printDate();

        MyDate myDate3 = new MyDate();
        myDate3.setDate(1123,5,4);
        System.out.println(myDate3.toString());
    }

    //类
    public static void main4(String[] args) {
        int a = 10;

        Dog dog1 = new Dog();
        dog1.name = "大黄";
        dog1.age = 6;
        dog1.brand = "中华田园犬";

        System.out.println(dog1.name);
        dog1.eat();
        dog1.bark();
        dog1.sleep();

        Dog dog2 = new Dog();
        Dog dog3 = new Dog();
    }


    //不规则数组
    public static void main3(String[] args) {
        int[][] array = new int[2][];
        array[0] = new int[3];
        array[1] = new int[5];

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
    }

    public static void main2(String[] args) {
        int[][] array ={{1, 2, 3}, {4, 5, 6}};

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j] + " ");
            }
        }

        System.out.println("行数：" + array.length);
        System.out.println("列数：" + array[0].length);
        System.out.println("=====================");

        for (int[] tmpArray : array) {
            for (int x : tmpArray) {
                System.out.print(x + " ");
            }
            System.out.println();
        }
        System.out.println("===========");
        //深打印，打印出每一个元素，直接toString则打印除了引用变量
        System.out.println(Arrays.deepToString(array));
    }

    public static void main1(String[] args) {
        int[][] array = {{1, 2, 3}, {4, 5, 6}};

        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 3; j++) {
                System.out.println(array[i][j] + " ");
            }
            System.out.println();
        }
        int[][] array2 = new int[][]{{1, 2, 3}, {4, 5, 6}};

        int[][] array3 = new int[2][3];

    }
}
